# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        
        # Deleting model 'Image'
        db.delete_table('service_image')

        # Adding model 'ServiceImage'
        db.create_table('service_serviceimage', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('image', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
            ('alt', self.gf('django.db.models.fields.CharField')(max_length=45, null=True, blank=True)),
            ('service', self.gf('django.db.models.fields.related.ForeignKey')(related_name='service_image_service', to=orm['service.Service'])),
            ('hero_image', self.gf('django.db.models.fields.BooleanField')(default=False)),
        ))
        db.send_create_signal('service', ['ServiceImage'])

        # Deleting field 'Category.hero_image'
        db.delete_column('service_category', 'hero_image_id')

        # Deleting field 'Service.hero_image'
        db.delete_column('service_service', 'hero_image_id')


    def backwards(self, orm):
        
        # Adding model 'Image'
        db.create_table('service_image', (
            ('alt', self.gf('django.db.models.fields.CharField')(max_length=45, null=True, blank=True)),
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('image', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
        ))
        db.send_create_signal('service', ['Image'])

        # Deleting model 'ServiceImage'
        db.delete_table('service_serviceimage')

        # Adding field 'Category.hero_image'
        db.add_column('service_category', 'hero_image', self.gf('django.db.models.fields.related.ForeignKey')(related_name='category_image', null=True, to=orm['service.Image'], blank=True), keep_default=False)

        # Adding field 'Service.hero_image'
        db.add_column('service_service', 'hero_image', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['service.Image'], null=True, blank=True), keep_default=False)


    models = {
        'service.category': {
            'Meta': {'object_name': 'Category'},
            'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'created_at': ('django.db.models.fields.DateTimeField', [], {}),
            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '45'}),
            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '45', 'db_index': 'True'}),
            'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
        },
        'service.service': {
            'Meta': {'object_name': 'Service'},
            'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
            'after_image': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'before_image': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
            'category': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['service.Category']"}),
            'created_at': ('django.db.models.fields.DateTimeField', [], {}),
            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '45'}),
            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '45', 'db_index': 'True'}),
            'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
        },
        'service.serviceimage': {
            'Meta': {'object_name': 'ServiceImage'},
            'alt': ('django.db.models.fields.CharField', [], {'max_length': '45', 'null': 'True', 'blank': 'True'}),
            'hero_image': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'image': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
            'service': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'service_image_service'", 'to': "orm['service.Service']"})
        }
    }

    complete_apps = ['service']
